<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="/../Thinkphp/Application/Home/View/User/jquery/jquery-3.0.0.js"></script>
        <script>
            $(function($){
                $(".delete").click(function(){    
                    var message=confirm("确定删除信息？");                    
                    if(message){
                        var url=$(this).attr("href");
                        var data={}; 
                        data['message']=message;
                        var dataType="json";
                        $.post(
                           url,
                           data,
                           function(data){                         
                                if(data.status===1){                             
                                   location.href=data.url;
                               }
                           },
                           dataType
                    );
                     return false;           
             }else{
                  return false;       
             } 
                });
            
          });
                
        </script>
    </head>
    <body>
        <div>
            <table border='1' cellspacing='0'>
                <tr>
                    <th>版本</th>
                    <th>模块分类</th>
                    <th>模块名</th>
                    <th>内容</th>
                    <th>图片</th>
                    <th>操作</th>                    
                </tr>
                <?php foreach($data as $key=>$value){?>                
                <tr>
                    <td><?php  if($value['version']==1){echo "Drupal 6";} if($value['version']==2){echo "Drupal 7";} if($value['version']==3){echo "Drupal 8";} ;?>
                    </td>   
                    <td><?php  if($value['category']==1){echo "手机";} if($value['category']==2){echo "字段";} if($value['category']==3){echo "安全";} ;?>
                    </td>   
                    <td><?php print $value['version'];?></td>   
                    <td><?php print $value['body'];?></td>   
                    <td>
                        <?php if(!empty($value['img'])){?>
                            <img src="/Thinkphp/<?php print $value['img'];?>">
                       <?php }?>
                    </td> 
                    <td>
                        <a href="<?php print U('Admin/content/update?id='.$value['id']);?>">编辑</a>
                        <a href="<?php print U('Admin/content/delete?id='.$value['id']);?>" class="delete">删除</a>
                    </td>
                </tr>
                <?php }?>
            </table>
        </div>
    </body>
</html>